// VolumeUnit1.cpp: implementation of the VolumeUnit class.
//
//////////////////////////////////////////////////////////////////////

#include "VolumeUnit.h"

#define TSP_TO_BASE_UNIT 1
#define TRSP_TO_BASE_UNIT (3*TSP_TO_BASE_UNIT)
#define OZ_TO_BASE_UNIT (2*TRSP_TO_BASE_UNIT)

#define TSP_NAME "TSP"
#define TRSP_NAME "TRSP"
#define OZ_NAME "OZ"

static Unit::UnitVector unitSeq;

VolumeUnit::VolumeUnit(const Amount& factor, const string& str)
:Unit(factor, str)
{
	setUnitSeq();
}

const VolumeUnit& VolumeUnit::getTsp()
{
	static const VolumeUnit tsp(TSP_TO_BASE_UNIT, TSP_NAME);
	return tsp;
}

const VolumeUnit& VolumeUnit::getTrsp()
{
	static const VolumeUnit trsp(TRSP_TO_BASE_UNIT, TRSP_NAME);
	return trsp;
}

const VolumeUnit& VolumeUnit::getOz()
{
	static const VolumeUnit oz(OZ_TO_BASE_UNIT, OZ_NAME);
	return oz;
}

const Unit* VolumeUnit::getBaseUnit()
{
	return &(getTsp());
}

void VolumeUnit::setUnitSeq()
{
	insert(&TSP, &unitSeq);
	insert(&TRSP, &unitSeq);
	insert(&OZ, &unitSeq);
}

Unit::UnitVector& VolumeUnit::getUnitSeq()
{
	return unitSeq;
}

